import 'package:flutter/material.dart';
import 'package:flutter_elm/pages/business_info.dart';
import 'package:flutter_elm/pages/business_list.dart';
import 'package:flutter_elm/pages/index.dart';
import 'package:flutter_elm/pages/login.dart';
import 'package:flutter_elm/pages/register.dart';
import 'package:flutter_elm/store/global_data.dart';
import 'package:provider/provider.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return ChangeNotifierProvider(
      create: (context)=> GlobalData(),
      child: MaterialApp(
          title: 'Flutter Demo',
          theme: ThemeData(
            colorScheme: ColorScheme.fromSeed(seedColor: Colors.blueAccent),
            useMaterial3: true,
          ),
          initialRoute: "/",
          routes: {
            "/": (context) => const IndexPage(title: "昆明市云南大学"),


            "index": (context) => const IndexPage(title: "昆明市云南大学"),
            "business_list": (context) => const BusinessListPage(title: "商家列表"),
            "business_info": (context) => const BusinessInfoPage(title: "商家信息"),


            "login": (context) => const LoginPage(title: "用户登录"),
            "register": (context) => const RegisterPage(title: "用户注册"),
          }
      ),
    );
  }
}
